<?php
/**
 * Description
 *
 * PHP version 7
 *
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-25 11:18:15
 * @lastTime 2020-05-01 23:05:30
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */

namespace Design\Structural\DependencyInjection;

class Database
{

    private $config;


    public function __construct(DatabaseConfiguration $config)
    {
        $this->config = $config;

    }//end __construct()


    public function getDsn(): string
    {
        return sprintf(
            '%s:%s@%s:%s',
            $this->config->getUsername(),
            $this->config->getPassword(),
            $this->config->getHost(),
            $this->config->getPort()
        );

    }//end getDsn()


}//end class
